-
Notifications
You must be signed in to change notification settings - Fork 459
Add DataFusionTableWidget::column_visibility
and use it to improve visibility defaults for the partition table
#9936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Web viewer built successfully. If applicable, you should also test it:
Note: This comment is updated whenever you push a commit. |
ef10d2c
to
3d49ec9
Compare
…visibility defaults for the partition table Also fixes the column ordering, which was wrongly based on their id.
3d49ec9
to
5f500eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm overall!
some code improvement suggestions and questions on exact semantics
pub type ColumnNameFn<'a> = Option<Box<dyn Fn(&ColumnDescriptorRef<'_>) -> String + 'a>>; | ||
|
||
pub type ColumnVisibilityFn<'a> = Option<Box<dyn Fn(&ColumnDescriptorRef<'_>) -> bool + 'a>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type names are a bit misleading imho. Shouldn't this be
pub type ColumnNameFn<'a> = Option<Box<dyn Fn(&ColumnDescriptorRef<'_>) -> String + 'a>>; | |
pub type ColumnVisibilityFn<'a> = Option<Box<dyn Fn(&ColumnDescriptorRef<'_>) -> bool + 'a>>; | |
pub type ColumnNameFn<'a> = Box<dyn Fn(&ColumnDescriptorRef<'_>) -> String + 'a>; | |
pub type ColumnVisibilityFn<'a> =Box<dyn Fn(&ColumnDescriptorRef<'_>) -> bool + 'a>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These type
s are basically to reduce the noise in the struct definition (which clippy complained about). They are not public (I removed that erroneous pub
qualifier btw). The actual public interface is the builder method (which spell the entire signature for clarity, since they are simple enough). So since this whole option-box thing is used twice (here and in the delegate), I'd rather leave it as is.
desc.short_name(), | ||
RECORDING_LINK_FIELD_NAME | ||
| DATASET_MANIFEST_ID_FIELD_NAME | ||
| DATASET_MANIFEST_REGISTRATION_TIME_FIELD_NAME | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matching on string here is extremely brittle and is already causing problems with #9983
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's a strange comment to make tbh. This code uses short_name
, which #9983 removed, hence the compilation error. What is brittle is our lack of standard around column names and how they relate to descriptors—see #9840. I've pushed a commit on #9983 which replaces short_name
by display_name
and tested that it still works as intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But does it make sense for this code to break when we change how columns are displayed (e.g. when we change the implementation of fn display_name
)? Wouldn't it be better to explicitly match against e.g. ColumnDescriptor::archetype_field_name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These columns don't have much metadata—basically just a raw record batch built ad hoc on the server. Specifically, they don't have an archetype. Again, we need a much strong system to relate record batch/dataframe column name with column descriptors, which must account for arbitrary tables sent by the server and/or users.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is Name
in the above screenshot? Is that ComponentName
? If so, can we match against that instead of display_name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For component column, it corresponds to component_name
(this view is a mirror of the fields of ComponentColumnDescriptor
). That field is currently only exposed indirectly in ColumnDescriptorRef
's methods. Doing it properly amounts to resolving the desc <-> column name problem.
@@ -115,6 +117,8 @@ impl Server { | |||
ui: &mut egui::Ui, | |||
dataset: &Dataset, | |||
) { | |||
const RECORDING_LINK_FIELD_NAME: &str = "recording link"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this hard-coded string? Where does it come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a column that is live injected using datafusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it live-injected? Who gives it this name? What other piece of code needs to be updated in tandem with this piece of code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the location of this const suggests, this is all local to this method. generate_partition_links
is what triggers that column generation (it takes a column name as input), and default_column_visibility
defines, well, what the columns are visible by default (and it wants that generated column to be visible by default).
Related
What
Title.
Also fixes the column ordering, which was wrongly based on their id. And rename a bunch of things for consistency.
Current default view: